<?php
/**
 * User: xuhong
 * Date: 2018/10/30
 */

namespace extend\wechat\mp;

class Custom
{
    public static function text($openid, $text)
    {
        $access_token = Voucher::accessToken()['access_token'];

        $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={$access_token}";
        $data = [
            'touser' => $openid,
            'msgtype' => 'text',
            'text' => [
                'content' => $text,
            ],
        ];
        $data = json_encode($data, JSON_UNESCAPED_UNICODE);
        return postRequest($url, $data);
    }
}